<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: htmlemail.php,v $ 
 * $Date: 2005/08/29 15:33:05 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
$query="SELECT html.* FROM hierarchie,html WHERE html.code='$code' AND html.droit=hierarchie.id_groupe AND hierarchie.id_groupe_dessus='$session[id_groupe]' AND html.publier='1'";
$result=rportalrequete($query) or rportalerreur($query,"?op=");
if(rportalnbresult($result)==0){
	rportalerreur("LA PAGE QUE VOUS ESSAYEZ D'ENVOYER N'EXISTE PAS","?op=");	
}
if($rportalparams->get_value("RPORTAL","email.actif")=="yes" && $code!=''){
	require_once(get_path_module("email.emailtype"));
	$an_url = $rportalparams->get_value("SITE","url");
	$an_url.="?op=html";
	$an_url.="&code=".$code;
	$email = new EmailType($rportalparams->get_value("RPORTAL","email.html.recommander"));
	$email->setFrom($nom_exp,$email_exp);
	$email->setAutreX(0,$an_url);
	$email->setAutreX(1,$commentaire);
	$email->setAutreX(2,$nom_exp);
	for($i=1;$i<=5;$i++){
		$v = "email_dest".$i;
		if($$v!=''){
			$email->setTo($$v,'','','','');
			$email->sendEmail();
		}	
	}
}
header("Location: ?op=html&code=".$code);
exit;
?>